package com.woniu.woniuproject.mapper;

import com.woniu.woniuproject.entity.looselabel_record;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * 功能描述:<br>
 * 〈〉
 *
 * @author 徐威
 * @create 2020/11/24
 * @since 1.0.0
 */
@Repository
public interface looselabel_recordMapper {
    @Insert("insert into t_loose_label_record (claimsId,userId,isReturned,currentTerm,receivableMoney,receivableDate) " +
            "values (#{claimsId},#{userId},#{isReturned},#{currentTerm},#{receivableMoney},#{receivableDate})")
     int insert(looselabel_record looselabel_records) ;
@Select("select ll.projectnumber,lr.receivableDate,lr.receivableMoney,lr.id,lr.recordDate,lr.currentTerm FROM t_loose_label as " +
        "ll JOIN t_loose_label_record as lr on ll.labelid=lr.claimsId WHERE ll.deborid =#{userid} and lr.isReturned=#{i}")
    List<looselabel_record> selectisReturned(@Param("i") int i,@Param("userid") int userid);
@Select("select * from t_loose_label_record where id = #{id}")
    looselabel_record selectBykey(Integer id);
@Update("update  t_loose_label_record set recordDate=#{date},isReturned = 1 where id =#{id}")
    void updateBykey(@Param("id") Integer id,@Param("date") Date date);
}
